package com.atguigu.ssyx.search.repository;

import com.atguigu.ssyx.model.search.SkuEs;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * ClassName: SkuRepository
 * Package: com.atguigu.ssyx.search.repository
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-09-27
 * Time: 11:23
 */

//相当于数据库的Mapper 泛型是 操作的实体类 和 主键类型
public interface SkuRepository extends ElasticsearchRepository<SkuEs,Long> {
    //    //Spring Data是一个用于简化数据库根据方法名称自动实现查询功能

    Page<SkuEs> findByOrderByHotScoreDesc(Pageable pageable);

    Page<SkuEs> findByCategoryIdAndWareId(Long categoryId, Long wareId, Pageable pageable);

    Page<SkuEs> findByKeywordAndWareId(String keyword, Long wareId,Pageable pageable);
}
